package com.zk.shop.controller;

import com.zk.shop.pojo.Role;
import com.zk.shop.service.RoleService;
import com.zk.shop.util.RespUtil;
import com.zk.shop.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/role")
@RestController
public class RoleController {

    @Autowired
    RoleService roleService;

    @RequestMapping("/list/{id}")
    public Result getRoleName(@PathVariable("id")Integer id){
        try{
            List<Role> list = roleService.roleList(id);
            return new RespUtil().LOK("111111","查询成功",true,list);
        }catch(Exception e){
            return new RespUtil().MOK("000000","【/role/list/】接口异常",false);
        }
    }
}
